﻿
using System.Collections.Generic;

namespace Nirvana.SoundCommon
{
    public class SoundDataManager : Singleton<SoundDataManager>
    {
        Dictionary<string, SoundConfig> soundDatas = new Dictionary<string, SoundConfig>();
        public override void Init()
        {
            base.Init();

            InitSoundData();
        }


        public SoundConfig GetSoundConfig(string name)
        {
            if (soundDatas.ContainsKey(name)) return soundDatas[name];
            return default(SoundConfig);
        }

        private void InitSoundData()
        {

            SoundConfig data = new SoundConfig();
            data.Id = 1001;
            data.mixerGroup = AudioItemMixerGroup.UISoundGroup;
            data.Name = "btn_click";
            data.resUrl = "Audio/Sound/btn_click";
            data.isLoop = false;
            data.volume = 1;
            data.priority = 1;
            data.fadeInTime = 0;
            data.fadeOutTime = 0;
            data.spatialBlend = 0;
            data.interval = 0.2f;
            data.maxCount = 3;

            soundDatas.Add(data.Name, data);

            data = new SoundConfig();
            data.Id = 1002;
            data.mixerGroup = AudioItemMixerGroup.MusicGroup;
            data.Name = "cuowu";
            data.resUrl = "Audio/Sound/cuowu";
            data.isLoop = false;
            data.volume = 1;
            data.priority = 1;
            data.fadeInTime = 0;
            data.fadeOutTime = 0;
            data.spatialBlend = 0;

            data.interval = 0f;
            data.maxCount = 0;

            soundDatas.Add(data.Name, data);

            data = new SoundConfig();
            data.Id = 1003;
            data.mixerGroup = AudioItemMixerGroup.MusicGroup;
            data.Name = "chuangjue";
            data.resUrl = "Audio/Sound/chuangjue";
            data.isLoop = false;
            data.volume = 1;
            data.priority = 1;
            data.fadeInTime = 0.3f;
            data.fadeOutTime = 0.3f;
            data.spatialBlend = 0;

            data.interval = 0f;
            data.maxCount = 0;

            soundDatas.Add(data.Name, data);

            data = new SoundConfig();
            data.Id = 1004;
            data.mixerGroup = AudioItemMixerGroup.MusicGroup;
            data.Name = "fight";
            data.resUrl = "Audio/Sound/fight";
            data.isLoop = false;
            data.volume = 1;
            data.priority = 1;
            data.fadeInTime = 0.3f;
            data.fadeOutTime = 0.3f;
            data.spatialBlend = 0;

            data.interval = 0f;
            data.maxCount = 0;

            soundDatas.Add(data.Name, data);

            data = new SoundConfig();
            data.Id = 1005;
            data.mixerGroup = AudioItemMixerGroup.MusicGroup;
            data.Name = "lanseduonaohe";
            data.resUrl = "Audio/Sound/lanseduonaohe";
            data.isLoop = false;
            data.volume = 1;
            data.priority = 1;
            data.fadeInTime = 0.3f;
            data.fadeOutTime = 0.3f;
            data.spatialBlend = 0;

            data.interval = 0f;
            data.maxCount = 0;

            soundDatas.Add(data.Name, data);
        }
    }
}